require("dotenv").config();
const uploadDao = require('../dao/uploadDao')
module.exports = {
  uploadAvatar: async (userId, file) => {
    const filePath = file.destination.replace('public', '')
    file.name = file.filename
    file.url = `${filePath}/${file.filename}`
    file.uploadDate = Date.now()
    const data = await uploadDao.uploadAvatar(userId, file)
    if (data) {
      return data
    }
  }
}